package com.example.demo.tool;

public enum AppHttpCodeEnum {
    // 成功
    SUCCESS(200,"操作成功"),
    // 新增成功
    CREATE_SUCCESS(201,"创建成功"),
    MODIFY_SUCCESS(200,"修改成功"),
    DEL_ERROR(405,"删除失败，数据不存在"),
    QUERYEXCEPTION(400,"查询失败,数据不存在"),
    DATAEXIST(400,"添加失败,数据已存在"),
    USER_USERNAME_ERR(400,"当前用户名不可用"),
    ROLE_NAME_ERR(400,"当前角色名不可用"),
    LOGIN_ERROR(400,"该账号无法登录，请联系管理员"),
    // 404
    NOTFOUND(404,"资源不存在"),
    // 登录
    NO_OPERATOR_AUTH(401,"未授权"),
    FORBIDDEN(403,"您的权限不足"),
    /**
     * 服务器未知错误
     */
    SYSTEM_ERROR(500,"服务器繁忙，请稍后重试");
    final int code;
    final String msg;
    AppHttpCodeEnum(int code, String errorMessage){
        this.code = code;
        this.msg = errorMessage;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

}
